package net.scdx.hotel.mapper;

import net.scdx.hotel.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserMapper {

    /**
     * insert user
     */
//@Param("password")
    int insert( @Param("user")User user) throws Exception;

    /**
     *  query specific user by name/password
     */
    User queryUserByUsernameOrPsw(@Param("username") String username,
                                    @Param("password") String password) throws Exception;

    /**
     * update user
     */
    int update(@Param("user") User user) throws Exception;

    List<User> selectByForeignKey(@Param("adminId")Integer adminId);

    void deleteUser(@Param("userId") Integer userId);

    User selectByPrimaryKey(@Param("userId") Integer userId);

    int updateByPrimaryKey(@Param("user") User user);
}